package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IAddGoods;
import com.itboye.mengwu.data.interfaces.IOrder;
import com.itboye.mengwu.data.interfaces.PrivateInter;
import com.itboye.mengwu.data.model.GoodsListModel;
import com.itboye.mengwu.data.model.OrderBean;
import com.itboye.mengwu.data.model.GoodsListModel.GoodsList;
import com.itboye.mengwu.data.model.PrivateXinMessgebean;
import com.itboye.mengwu.data.repository.AddGoodsRepository;
import com.itboye.mengwu.data.repository.OrderRepository;
import com.itboye.mengwu.data.repository.PrivateRepository;

public class PrivatePresenter extends BasePresenter implements
		PrivateInter<PrivateXinMessgebean> {

	public static final String private_success = MainPresenter.class
			.getName() + "_private_success";
	public static final String private_fail = MainPresenter.class.getName()
			+ "_private_fail";

	
	public static final String delete_success = MainPresenter.class
			.getName() + "_delete_success";
	public static final String delete_fail = MainPresenter.class.getName()
			+ "_delete_fail";
	
	
	//私信详情
	public static final String sixinxiangqing_success = MainPresenter.class
			.getName() + "_sixinxiangqing_success";
	public static final String sixinxiangqing_fail = MainPresenter.class.getName()
			+ "_sixinxiangqing_fail";
	
	//发送私信
	public static final String sixinfasong_success = MainPresenter.class
			.getName() + "_sixinfasong_success";
	public static final String sixinfasong_fail = MainPresenter.class.getName()
			+ "_sixinfasong_fail";
	
	
	//获取版本信息
		public static final String version_success = MainPresenter.class
				.getName() + "_version_success";
		public static final String version_fail = MainPresenter.class.getName()
				+ "_version_fail";
	
	
	
	public PrivatePresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(PrivateXinMessgebean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(PrivateXinMessgebean model) {
		// TODO Auto-generated method stub
		PrivateInter<PrivateXinMessgebean> addGoods = new PrivateRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(delete_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(delete_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.delete(model);//(model);
		

	}

	@Override
	public void update(PrivateXinMessgebean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(PrivateXinMessgebean model) {
		// TODO Auto-generated method stub

		PrivateInter<PrivateXinMessgebean> addGoods = new PrivateRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(private_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(private_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.getInfo(model);// ("", "", "", "");

	}

	@Override
	public List<PrivateXinMessgebean> query(PrivateXinMessgebean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void SiXinXiangQing(String curr_uid, String rela_uid, String start_time, String page_no, String page_size) {
		PrivateInter<PrivateXinMessgebean> addGoods = new PrivateRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(sixinxiangqing_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(sixinxiangqing_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.SiXinXiangQing(curr_uid, rela_uid, start_time, page_no, page_size);//(model);
		
	}

	@Override
	public void FaSongSiXin(String uid, String to_uid, String message) {
		PrivateInter<PrivateXinMessgebean> addGoods = new PrivateRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(sixinfasong_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(sixinfasong_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.FaSongSiXin(uid, to_uid, message);//(model);
		
	}

	@Override
	public void getVersion() {
		PrivateInter<PrivateXinMessgebean> addGoods = new PrivateRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(version_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(version_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.getVersion();
		
	}

}
